# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=kubepug
pkgver=1.3.4
pkgrel=0
pkgdesc="Kubernetes pre-upgrade deprecation checker"
url="https://github.com/rikatz/kubepug"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/rikatz/kubepug/archive/refs/tags/v$pkgver.tar.gz"

build() {
	go build -v -ldflags "-X sigs.k8s.io/release-utils/version.gitVersion=v$pkgver" -o bin/$pkgname

	for shell in bash zsh fish; do
		./bin/kubepug completion $shell > kubepug.$shell
	done
}

check() {
	go test ./...
}

package() {
	install -Dm755 bin/$pkgname -t "$pkgdir"/usr/bin

	install -Dm644 kubepug.bash \
		"$pkgdir"/usr/share/bash-completion/completions/kubepug
	install -Dm644 kubepug.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_kubepug
	install -Dm644 kubepug.fish \
		"$pkgdir"/usr/share/fish/completions/kubepug.fish
}

sha512sums="
344156087ead353d5ccf37575fc2b432fd0ad3678357338be01516805024a099cdec45ba6474497f461370295f202649a9fccc1f08991b4755f2ee21acd94f21  kubepug-1.3.4.tar.gz
"
